
<div class="page-container">
    <h1>注册</h1>
    <form id="registForm" action="${basePath}/regist" method="post">
        <input type="text" name="username" class="username" placeholder="Username">
        <input type="password" name="password" class="password" placeholder="Password">
        <input type="password" name="rpassword" class="rpassword" placeholder="Second password">
        <input type="email" name="email" placeholder="email">
        <input type="text" name="phone" placeholder="mobile phone">
        <button type="button" id="registSubmit">注册</button>
        <div class="error"><span>+</span></div>
    </form>
</div>
<script type="text/javascript">
    $('#registSubmit').click(
        function () {
            $.ajax({
                cache: true,
                type: "POST",
                url:"${basePath}/regist",
                data:$('#registForm').serialize(),
                async: false,
                error: function() {
                    layer.msg("服务异常",{icon:2});
                },
                success: function(data) {
                    if(data.bizCode=="1"){
                        layer.msg("注册成功,即将跳转至登录页",{icon:1});
                        setTimeout("back()",3000);
                    }else {
                        layer.msg("注册失败",{icon:2});
                    }

                }
            });
        }
    );

    function back() {
        window.location = "${basePath}/loginIndex";
    }

</script>

